package com.zhuss.controller.core;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.common.AbstractBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.SelectVo;
import com.zhuss.core.part.PartReadServiceExt;
import com.zhuss.core.processor.EnumConfig;
import com.zhuss.enums.Area;
import com.zhuss.enums.BannerType;
import com.zhuss.enums.CompanyType;
import com.zhuss.enums.CreamType;
import com.zhuss.enums.EnumUtil;
import com.zhuss.enums.Floor;
import com.zhuss.enums.Floor2;
import com.zhuss.enums.FoodTime;
import com.zhuss.enums.InfoType;
import com.zhuss.enums.InfoVisible;
import com.zhuss.enums.IsEnum;
import com.zhuss.enums.OpusType;
import com.zhuss.enums.ProposalStatus;
import com.zhuss.enums.PublishStatus;
import com.zhuss.enums.PublishUserStatus;
import com.zhuss.enums.QuestionType;
import com.zhuss.enums.RequestMethod;
import com.zhuss.enums.ResourceType;
import com.zhuss.enums.RoleType;
import com.zhuss.enums.Sex;
import com.zhuss.enums.StartStopEnum;
import com.zhuss.enums.SystemEnum;
import com.zhuss.exception.WpsException;


/**
 * 下拉框 controller
 * @Author zhushanshuo
   @Date 2019-11-27 19:58
 *
 */
  
@RestController
@RequestMapping("/select")
public class SelectController extends BaseController {
	
	@Autowired
	@Qualifier("partReadServiceExt")
	private PartReadServiceExt partReadServiceExt;
	
	@Autowired
	private EnumConfig enumConfig;

	/**
	 * 满意度问卷是否填写状态
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/publishUserStatusList")
	public Object publishUserStatusList() throws WpsException {
		return EnumUtil.listSelect(PublishUserStatus.class);
	}
	
	/**
	 * 获取问题类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/bannerTypeList")
	public Object bannerTypeList() throws WpsException {
		return EnumUtil.listSelect(BannerType.class);
	}


	/**
	 * 获取问题类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/questionType")
	public Object questionType() throws WpsException {
		return EnumUtil.listSelect(QuestionType.class);
	}

	/**
	 * 获取意见建议状态
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/proposalStatus")
	public Object proposalStatus() throws WpsException {
		return EnumUtil.listSelect(ProposalStatus.class);
	}

	/**
	 * 满意度问卷发布记录状态
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/publishStatusList")
	public Object publishStatusList() throws WpsException {
		return EnumUtil.listSelect(PublishStatus.class);
	}

	/**
	 * 信息发布类型下拉框
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/infoTypeList")
	public Object infoTypeList() throws WpsException {
		return EnumUtil.listSelect(InfoType.class);
	}

	/**
	 * 信息发布可见性下拉框
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/infoVisibleList")
	public Object infoVisibleList() throws WpsException {
		return EnumUtil.listSelect(InfoVisible.class);
	}
	
	/**
	 * 是否下拉框
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/isList")
    public Object isList() throws WpsException {
		return EnumUtil.listSelect(IsEnum.class);
    }
	
	/**
	 * 系统
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/systemList")
    public Object systemList() throws WpsException {
		return EnumUtil.listSelect(SystemEnum.class);
    }
	
	/**
	 * 资源类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
    @RequestMapping("/resourceTypeList")
    public Object resourceTypeList() throws WpsException {
		return EnumUtil.listSelect(ResourceType.class);
    }
	
	/**
	 * 请求方法
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/requestMethodList")
	public Object requestMethodList() throws WpsException {
		return EnumUtil.listSelect(RequestMethod.class);
	}
	
	/**
	 * 角色类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/roleTypeList")
	public Object roleTypeList() throws WpsException {
		return EnumUtil.listSelect(RoleType.class);
	}
	
	/**
	 * 启用停用
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/startStopList")
	public Object startStopList() throws WpsException {
		return EnumUtil.listSelect(StartStopEnum.class);
	}
	
	/**
	 * 性别
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/sexList")
	public Object sexList() throws WpsException {
		return EnumUtil.listSelect(Sex.class);
	}
	
	/**
	 * 作品类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/opusTypeList")
	public Object opusTypeList() throws WpsException {
		return EnumUtil.listSelect(OpusType.class);
	}
	
	/**
	 * 作品优选类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/opusCreamList")
	public Object opusCreamList() throws WpsException {
		return EnumUtil.listSelect(CreamType.class);
	}
	
	/**
	 * 公司类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/companyTypeList")
	public Object companyTypeList() throws WpsException {
		return EnumUtil.listSelect(CompanyType.class);
	}
	
	/**
	 * foodTime
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/foodTimeList")
	public Object foodTimeList() throws WpsException {
		return EnumUtil.listSelect(FoodTime.class);
	}
	
	/**
	 * foodTime
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/floorList")
	public Object floorList(@RequestBody AbstractBo bo) throws WpsException {
		List<SelectVo> result = new ArrayList<SelectVo>();
		Integer area = bo.getConcurrentArea();
		if (Area.西区.sameKey(area)) {
			result = EnumUtil.listSelect(Floor.class);
		} else {
			result = EnumUtil.listSelect(Floor2.class);
		}
		return result;
	}
	
	/**
	 * 餐品类型
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/foodCategoryList")
	public Object foodCategoryList(@RequestBody AbstractBo bo) throws WpsException {
		return enumConfig.listSelectFoodCategory(bo.getConcurrentArea());
	}
	
	/**
	 * 区域
	 * @return
	 * @throws WpsException
	 */
	@ResponseBody
	@RequestMapping("/areaList")
	public Object areaList() throws WpsException {
		return partReadServiceExt.areaList();
	}
	



	
}
